<template>
  <div class="component-home">
    <div class="component-home-title">您最喜欢的咖啡和实惠的价格</div>
    <div class="component-home-desc">您的咖啡会送到的</div>
    <!-- <div class="search-container">
      <input
        type="text"
        placeholder="请输入最喜欢的咖啡"
        class="search-input"
      />
    </div> -->
    <!-- <div class="recommendations-container">
      <div class="recommendations-container-title">推荐</div>
      <div class="recommendations-container-content">
        <div class="item active">热销</div>
        <div class="item">最受欢迎</div>
      </div>
    </div> -->
    <div class="shop-container">
      <div class="shop-container-title">
        <div class="left">热销</div>
        <div class="right" @click="goMenu">全部</div>
      </div>
      <div class="shop-container-content">
        <div class="item" v-for="item in list" :key="item" @click="showPopUp">
          <div class="item-name">原汁原味甜黑万隆咖啡</div>
          <div class="item-price">$350,00</div>
          <div class="item-image">
            <img
              src="@/assets/images/cupImg.png"
              alt=""
              class="item-coffeeImage"
            />
            <div class="item-content">
              <div class="love">
                <img src="@/assets/icons/love.svg" alt="" />
              </div>
              <div class="cart">
                <img src="@/assets/icons/cart.svg" alt="" />
              </div>
            </div>
          </div>
          <div class="item-desc">冰的/普通的/少糖的</div>
        </div>
      </div>
    </div>
    <div class="cart-box" @click="goOrderCoffee">
      <div class="price">$382.02</div>
      <div class="desc">( 包邮 )</div>
    </div>
    <PopUp :visible="popUpVisible" @closePopUp="closePopUp"></PopUp>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from "vue";
import { useRouter } from "vue-router";
import PopUp from "@/components/PopUp.vue";
export default defineComponent({
  components: {
    PopUp,
  },
  setup() {
    const router = useRouter();
    const popUpVisible = ref(false);
    const goMenu = () => {
      router.push("/ourMenu");
    };
    const goOrderCoffee = () => {
      router.push("/orderCoffee");
    };
    function closePopUp() {
      popUpVisible.value = false;
    }
    function showPopUp() {
      popUpVisible.value = true;
    }
    const list = ref([1, 2, 3, 4]);
    return {
      goMenu,
      goOrderCoffee,
      list,
      popUpVisible,
      closePopUp,
      showPopUp,
    };
  },
});
</script>

<style lang="less" >
.component-home {
  min-height: calc(100vh - 100px);
  background: url("~@/assets/images/pureImg.jpg");
  padding-left: 60px;
  padding-top: 96px;
  box-sizing: border-box;
  &-title {
    font-size: 46px;
    font-family: Helvetica;
    color: #ffffff;
    line-height: 62px;
  }
  &-desc {
    font-size: 28px;
    font-family: Helvetica;
    color: #ffffff;
    line-height: 34px;
    margin-top: 24px;
  }
  .search-container {
    margin-top: 54px;
    width: 524px;
    height: 112px;
    padding: 0 40px;
    background: #fff;
    border-radius: 50px;
    display: flex;
    align-items: center;
  }
  .search-input {
    height: 60px;
  }
  .recommendations-container {
    &-title {
      margin: 40px 0;
      font-size: 38px;
      font-family: Helvetica;
      color: #ffffff;
    }
    &-content {
      display: flex;
      align-items: center;
      margin-bottom: 40px;
      .active {
        background: #f6a44e !important;
        color: #fff !important;
      }
      .item {
        width: 280px;
        height: 92px;
        border-radius: 80px;
        background: rgba(255, 255, 255, 0.49);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        font-weight: 800;
        color: #d4b08b;
        &:first-child {
          margin-right: 46px;
        }
      }
    }
  }
  .shop-container {
    font-size: 38px;
    font-family: Helvetica;
    color: #442916;
    line-height: 62px;
    padding-right: 60px;
    padding-bottom: 200px;
    margin-top: 40px;
    &-title {
      display: flex;
      justify-content: space-between;
      align-items: center;
      color: #333;
      .right {
        background: #ed9e4b;
        color: #fff;
        width: 140px;
        height: 80px;
        display: flex;
        justify-content: center;
        align-items: center;
        border-radius: 50px;
      }
    }
    &-content {
      width: 100%;
      overflow-x: auto;
      display: flex;
      .item {
        width: 374px;
        background: #ffffff;
        box-shadow: 0px 58px 88px 0px rgba(0, 0, 0, 0.05),
          140px 144px 468px 0px rgba(53, 64, 90, 0.1);
        border-radius: 20px;
        padding: 33px;
        margin-top: 40px;
        margin-right: 60px;
        &-name {
          font-size: 28px;
          font-family: Helvetica;
          color: #264062;
          line-height: 40px;
        }
        &-price {
          height: 46px;
          font-size: 24px;
          font-family: Avenir-Heavy, Avenir;
          font-weight: 800;
          color: #8b9bb1;
          line-height: 46px;
        }
        &-desc {
          font-size: 20px;
          font-family: Helvetica;
          color: #8b9bb1;
          line-height: 24px;
          text-shadow: 0px 58px 88px rgba(0, 0, 0, 0.05);
          border-top: 2px solid #dee2ee;
          padding-top: 22px;
        }
        &-image {
          height: 300px;
          display: flex;
          align-items: center;
          justify-content: space-between;
        }
        &-coffeeImage {
          width: 280px;
        }
        &-content {
          .love {
            width: 82px;
            height: 74px;
            background: #ffffff;
            border-radius: 16px;
            border: 2px solid #dee2ee;
            display: flex;
            justify-content: center;
            align-items: center;
            img {
              width: 40px;
            }
          }
          .cart {
            width: 82px;
            height: 74px;
            background: #38a971;
            border-radius: 16px;
            border: 2px solid #dee2ee;
            display: flex;
            justify-content: center;
            align-items: center;
            margin-top: 40px;
            img {
              width: 40px;
            }
          }
        }
      }
    }
  }
  .cart-box {
    position: fixed;
    left: 60px;
    bottom: 140px;
    width: 630px;
    height: 120px;
    background: #442916;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    .price {
      font-size: 28px;
      margin-right: 10px;
    }
    .desc {
      font-size: 24px;
      color: #897568;
    }
  }
}
</style>
